<?php namespace App\Infra;

use App\Utils\ModelSDK\ModelOperator;
use App\Models\Message;
use App\Models\Reply;

class MessageManage{

	use ModelOperator;

	public function getMessages($conditions){
		return $this->findModel(Message::class,Message::query()->with(['replys','wechatUser.wechatUserInfo'])->orderBy('created_at','DESC'),$conditions,$first = true);
	}

	public function createReply($data){
		Reply::create($data);
	}

	public function getUser($conditions){
		return $this->findModel(Message::class,Message::query()->with(['wechatUser']),$conditions,false);
	}

}